package com.ruoyi.web.controller.app.user;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.web.utils.COSUtil;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Controller
@Tag(name = "COSUploadController", description = "文件上传")
@RequestMapping("/cosUpload")
public class COSUploadController {


    @RequestMapping(value = "/upload", method = RequestMethod.POST)
    @ResponseBody
    public R<?> upload(MultipartFile file) throws IOException {
       return R.ok("上传成功",COSUtil.uploadFile(file));
    }


}
